<div class="dialog">
    <table>
        <tbody>
        
            
            <tr class="prop">
                <td valign="top" class="name"><g:message code="stockIn.serialNumber" default="Serial Number" />:</td>
                <td valign="top" class="value">${fieldValue(bean: stockInInstance, field: "serialNumber")}</td>
            
                <td valign="top" class="name"><g:message code="stockIn.recordType" default="Record Type" />:</td>
                <td valign="top" class="value">
                    <g:link controller="recordType" action="show" id="${stockInInstance?.recordType?.id}">${stockInInstance?.recordType?.encodeAsHTML()}</g:link>
                </td>
                
                <td valign="top" class="name"><g:message code="stockIn.purchase" default="Purchase" />:</td>
                <td valign="top" class="value">
                    <g:link controller="purchase" action="show" id="${stockInInstance?.purchase?.id}">${stockInInstance?.purchase?.encodeAsHTML()}</g:link>
                </td>
            </tr>
            
            <tr class="prop">
                <td valign="top" class="name"><g:message code="stockIn.dealer" default="Dealer" />:</td>
                <td valign="top" class="value">
                    <g:link controller="dealer" action="show" id="${stockInInstance?.dealer?.id}">${stockInInstance?.dealer?.encodeAsHTML()}</g:link>
                </td>
            
                <td valign="top" class="name"><g:message code="stockIn.date" default="Date" />:</td>
                <td valign="top" class="value"><g:formatDate date="${stockInInstance?.date}" format="yyyy-MM-dd"/></td>
            
                <td valign="top" class="name"><g:message code="stockIn.maker" default="Maker" />:</td>
                <td valign="top" class="value">
                    <g:link controller="staff" action="show" id="${stockInInstance?.maker?.id}">${stockInInstance?.maker?.encodeAsHTML()}</g:link>
                </td>
            </tr>
            
            <tr class="prop">
                <td valign="top" class="name"><g:message code="stockIn.approved" default="Approved" />:</td>
                <td valign="top" class="value"><g:formatBoolean boolean="${stockInInstance?.approved}" /></td>
            
                <td valign="top" class="name"><g:message code="stockIn.dateCreated" default="Date Created" />:</td>
                <td valign="top" class="value"><g:formatDate date="${stockInInstance?.dateCreated}" format="yyyy-MM-dd HH:mm:ss"/></td>
            
                <td valign="top" class="name"><g:message code="stockIn.lastUpdated" default="Last Updated" />:</td>
                <td valign="top" class="value"><g:formatDate date="${stockInInstance?.lastUpdated}" format="yyyy-MM-dd HH:mm:ss"/></td>
                
            </tr>
            
        </tbody>
    </table>
</div>
<div class="list">
    <table>
        <thead>
            <tr>
                <th><g:message code="stockInDetail.serialNumber" default="Serial Number" /></th>
                <th><g:message code="stockInDetail.purchaseDetail" default="Purchase Detail" /></th>
                <th><g:message code="stockInDetail.dealer" default="Dealer" /></th>
                <th><g:message code="stockInDetail.product" default="Product" /></th>
                <th><g:message code="stockInDetail.life" default="Life" /></th>
                <th><g:message code="stockInDetail.unit" default="Unit" /></th>
                <th><g:message code="stockInDetail.warehouse" default="Warehouse" /></th>
                <th class="number"><g:message code="stockInDetail.quantity" default="Quantity" /></th>
                <th class="number"><g:message code="stockInDetail.used" default="Used" /></th>
                <th class="number"><g:message code="stockInDetail.surplus" default="Surplus" /></th>
                <th class="number"><g:message code="stockInDetail.price" default="Price" /></th>
                <th class="number"><g:message code="stockInDetail.amount" default="Amount" /></th>
                <th class="number"><g:message code="stockInDetail.isOver" default="Over?" /></th>
            </tr>
        </thead>
        <tbody>
        <g:each in="${stockInInstance?.details?.sort{it?.serialNumber}}" status="i" var="stockInDetailInstance">
            <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                <!--serialNumber-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "serialNumber")}
                </td>
                <!--purchase detail-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "purchaseDetail")}
                </td>
                <!--dealer-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "dealer")}
                </td>
                <!--product-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "product")}
               </td>
                <!--life-->
                <td>
                    ${formatDate(format:'yyyy-MM-dd', date : stockInDetailInstance?.life) }
                </td>
                <!--unit-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "unit")}
                </td>
                <!--warehouse-->
                <td>
                    ${fieldValue(bean: stockInDetailInstance, field: "warehouse")}
                </td>
                <!--quantity-->
                <td class="number">
                    <g:formatNumber number="${stockInDetailInstance?.quantity}" format="###,##0.00" />
                </td>
                <!--used-->
                <td class="number">
                    <g:formatNumber number="${stockInDetailInstance?.used}" format="###,##0.00" />
                </td>
                <!--surplus-->
                <td class="number">
                    <g:formatNumber number="${stockInDetailInstance?.surplus}" format="###,##0.00" />
                </td>
                <!--price-->
                <td class="number">
                    <g:formatNumber number="${stockInDetailInstance?.price}" format="###,##0.00" />
                </td>
                <!--amount-->
                <td class="number">
                    <g:formatNumber number="${stockInDetailInstance?.amount}" format="###,##0.00" />
                </td>
                <!--Over?-->
                <td class="number">
                    <g:formatBoolean boolean="${stockInDetailInstance?.isOver}" />
                </td>
            </tr>
        </g:each>
        </tbody>
    </table>
</div>

